<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    li {
      width: 100px;
      height: 100px;
    }
  </style>
</head>

<body>
  <script>
    let arr = [
      // './image/1.webp',
      // './image/2.webp',
      // './image/3.webp',
      // './image/4.webp',
      // './image/5.webp',
      // './image/6.webp',
      // './image/7.webp',
      // './image/8.webp',
      // './image/9.webp',
      // './image/10.webp',
      // './image/11.webp',
      // './image/12.webp',
      // './image/13.webp',
      // './image/14.webp',
      // './image/15.webp',
      // './image/16.webp',
      // './image/17.webp',
      // './image/18.webp',
      // './image/19.webp',
      // './image/20.webp'
    ]
    let num = prompt("请输入图片个数")
    for (let i = 0; i < num; i++) {
      arr.push(`<img src="../image/${i + 1}.webp">`)
      document.write(`
        <li>
          <img src="${arr[i]}">
        </li>
        `)
    }
  </script>
</body>

</html>